<?php
/**
 * Created by PhpStorm.
 * User: hebidu
 * Date: 15/12/3
 * Time: 11:14
 */

namespace Test\Controller;



use Api\Vendor\BoyeUtils\BoyeUtils;
use Common\Api\BoyeServiceApi;

class TestGatewayController extends TestController{



    public function index(){

        dump(S('global_config'));

        if(IS_POST){

            $data = array(

                'api_ver'=>$this->api_ver,
                'notify_id'=>$this->notify_id,
                'type'=>'BY_User_login',
                'alg'=>'md5',
            );

            $service = new BoyeServiceApi();

            $result = $service->callRemote("",$data,true);

            dump("解密后的数据");
            dump($result);
            exit();
        }

        $data = array(
            'username'=> 'M15858199164',
            "password"=>'123456',
        );

        $data = BoyeUtils::encrypt($data);

        $param = array(
            'client_id'=>CLIENT_ID,
            'api_ver'=>'101',
            'notify_id'=>'111',
            'time'=>strval(time()),
            'data'=>$data,
            'type'=>'BY_User_login',
            'alg'=>'md5',
        );

        $param['sign'] = BoyeUtils::sign($param);
        echo "传输的参数";
        dump($param);

        $this->assign("param",$param);
        $this->display();

    }




}